package main

import (
	"device/util"
	"fmt"
	"net/http"
	"net/http/httputil"
)

func getServer(gatawatport string) {
	//url := "http://192.168.146.11:10000/hello"

	url := "http://192.168.146.1:" + util.ToServerPort(gatawatport) + "/hello"
	// 创建一个HTTP GET请求
	resp, err := http.Get(url)
	if err != nil {
		fmt.Println("Error fetching URL:", err)
		return
	}
	defer resp.Body.Close()

	// 打印响应状态码
	fmt.Println("Response Status Code:", resp.StatusCode)

	// 打印响应内容
	if resp.StatusCode == http.StatusOK {
		body, err := httputil.DumpResponse(resp, true)
		if err != nil {
			fmt.Println("Error dumping response:", err)
			return
		}
		fmt.Printf("%s", body)
	}
}
